package com.axonactive.training.bean;

import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.inject.Inject;

import com.axonactive.training.model.Book;
import com.axonactive.training.service.BookService;

@ManagedBean
@RequestScoped
public class BookManagementBean {
	private String title;
	
	@Inject
	BookService bookService;
	
	public void addBook(){
		Book book = new Book(title);
		bookService.addBook(book);
		title = "";
	}
	
	public List<Book> getBooks(){
		return bookService.getBookList();
	}

	public String gettitle() {
		return title;
	}

	public void settitle(String title) {
		this.title = title;
	}	
}
